|
Late binding, or dynamic binding,〔Booch, Grady. Object-oriented Analysis and Design. Addison-Wesley, 1994. p71〕 is a computer programming mechanism in which the method being called upon an object or the function being called with arguments is looked up by name at runtime. With early binding, or static binding, in an object-oriented language, the compilation phase fixes all types of variables and expressions. This is usually stored in the compiled program as an offset in a virtual method table ("v-table") and is very efficient. With late binding the compiler does not have enough information to verify the method even exists, let alone bind to its particular slot on the v-table. Instead the method is looked up by name at runtime. The primary advantage of using late binding in Component Object Model (COM) programming is that it does not require the compiler to reference the libraries that contain the object at compile time. This makes the compilation process more resistant to version conflicts, in which the class's v-table may be accidentally modified. (This is not a concern in JIT-compiled platforms such as .NET or Java, because the v-table is created at runtime by the virtual machine against the libraries as they are being loaded into the running application.) ==History== The term "late binding" dates back to at least the 1960s, where it can be found in ''Communications of the ACM''. The term was widely used to describe calling conventions in languages like Lisp, though usually with negative connotations about performance.〔Software engineering techniques, J. N. Buxton, Brian Randell, NATO Science Committee, NATO Science Committee, 1970〕 In the 1980s Smalltalk popularized object-oriented programming (OOP) and with it late binding. Dr. Alan Kay once said, "OOP to me means only messaging, local retention, and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them." In the early to mid-1990s, Microsoft heavily promoted its COM standard as a binary interface between different OOP programming languages. COM programming equally promoted early and late binding, with many languages supporting both at the syntax level. In 2000, Alex Martelli coined the term "duck typing" to refer to a similar concept, but with a different emphasis. While late binding generally focuses on implementation details, duck typing focuses on the ability to ignore types and concentrate on the methods an object currently has. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Late binding」の詳細全文を読む スポンサード リンク
|